<template>
    <van-form @submit="onSubmit">
        <van-cell-group inset>
            <van-field
                    v-model="user.username"
                    label="用户名"
                    placeholder="用户名"
                    :rules="[{ required: true, message: '请填写用户名' },{ pattern: /^[a-z]{6,10}$/,message:'小写字母6-10位'}]"
            />
            <van-field
                    v-model="user.password"
                    type="password"
                    label="密码"
                    placeholder="密码"
                    :rules="[{ required: true, message: '请填写密码' }]"
            />
        </van-cell-group>
        <div style="margin: 16px;">
            <van-button round block type="primary" native-type="submit">
                提交
            </van-button>
        </div>
    </van-form>
</template>

<script>
import axios from "axios";

export default {
    name: "login",
    data(){
        return{
          user:{
              username:'',
              password:''
          }
        }
    },
    methods:{
        onSubmit(){
          axios({
              url:'asfkjas',
              method:'post',
              data:{
                  username:'admin',
                  password:'admin'
              }
          })
        }
    }
}
</script>

<style scoped lang="stylus">

</style>